#include <iostream>
#include <algorithm>
#include <string>
#include <deque>
#include <set>
#include <valarray>
#include <cstdlib>
using namespace std;
struct cmp
{
    bool operator()(int v1,int v2)
    {
        return to_string(v1).size()<to_string(v2).size();
    }
};
int main_3()
{
    initializer_list<int> il= {14,2,8,1,30,110,220};
    cout << *max_element(il.begin(),il.end(),cmp()) << endl;
    valarray<int> v {4,2,-3,7,1,8,-9};
    v[slice(1,3,2)]=-10;
    valarray<int> sqrt_val=sqrt(abs(v));
    for(auto val:sqrt_val)
    {
        cout << val << " ";
    }
    cout  << endl;
    deque<int> deq {1,2,4,-6,7,2,8,3,0,7};
    random_shuffle(deq.begin(),deq.end());
    for (int ele:deq )
    {
        cout << ele << " ";
    }
    putchar('\n');
    cout << *max_element(deq.begin(),deq.end()) << endl;
    cout << *min_element(deq.begin(),deq.end()) << endl;
    set<int> s {1,2,4,-6,7,2,8,3,0,7};
    for (int ele:s )
    {
        cout << ele << " ";
    }
    putchar('\n');
    cout << *s.end() << endl;
    cout << *s.begin() << endl;
    int arr[] {-2,4,-1,5,3,-4,8};
    sort(arr,arr+sizeof(arr)/sizeof(int));
    cout << *arr << endl;
    return 0;
}
